import { useState } from 'react'

export default function App() {
  // 不能放到 for、if、函数等可能影响 hook 生成次数/顺序的操作中
  const [count, setCount] = useState(0)
  const [age, setAge] = useState(18)
  const [num, setNum] = useState(3)
  return (
    <div>
      <h3>count: {count}</h3>
      <h3>age: {age}</h3>
      <h3>num: {num}</h3>
      <button onClick={() => setCount(count + 1)}>count+1</button>
      <button onClick={() => setAge(count + 1)}>age+1</button>
      <button onClick={() => setNum(num + 1)}>num+1</button>
    </div>
  )
}
